


    ## WinBUGS code for a Varying-Intercept Model with Congress-Level Predictor  
    
    model {
    for (i in 1:N){
        Y[i] ~ dnorm(mu.y[i], tau.y)
        mu.y[i] <- alpha[congress[i]] + 
                   alpha1[senator[i]] + 
                   beta1[congress[i]]*X3[i] 
        }

        # priors
        tau.y <- pow(sigma.y, -2)
        sigma.y ~ dunif(0, 100)
        
        for (k in 1:K){
        alpha1[k] ~ dnorm(0,0.1)
        }
        
        for (j in 1:J){
        beta1[j] ~ dnorm(0, 0.1)
        alpha[j] ~ dnorm(mu.alpha[j], tau.alpha)
        mu.alpha[j] <- gamma[1] + 
                       gamma[2]*Z1[j] + 
                       gamma[3]*Z2[j] + 
                       gamma[4]*Z3[j] + 
                       gamma[5]*Z4[j] + 
                       gamma[6]*Z5[j]          
        }

        # priors
        for (i in 1:n.gamma){
        gamma[i] ~ dnorm(0, 0.1)
        }
        tau.alpha <- pow(sigma.alpha, -2)
        sigma.alpha ~ dunif(0, 100)
    }

